﻿Public Class AsPrintable(Of T)

    Public Property [Obejct]() As T
    Public Property Stringify As Func(Of T, String)

    Public Sub New(ByVal obj As T, ByVal DelStringify As Func(Of T, String))
        Me.Obejct = obj
        Me.Stringify = DelStringify
    End Sub

    Public Overrides Function ToString() As String
        If Me.Stringify IsNot Nothing Then
            Return Me.Stringify(Me.Obejct)
        Else
            Return Me.Obejct.ToString()
        End If
    End Function

End Class